<?php
defined('EXEC') or die();
function readMenu($menuxml){
	global $pages;
	foreach ($menuxml->li as $li){
		$href = @$li->a['href'];
		$parts = explode('=', $href);
		unset($parts[0]);
		$parts = implode('=', $parts);
		$parts = explode('/', $parts);
		$menuitem = $parts[count($parts) - 1];
		if($menuitem)
		$pages[$menuitem] = array(	'label' => (string) $li->a, 'link' => (string) $href );
			
		if(@$li->ul){
			readMenu($li->ul);
		}
	}
}
?><div id="topo">	<div id="nome">	<?php echo Config::SYSTEM; ?>	</div>	<div id="sair">		<a href="javascript:void(0);" id="button_logout">Sair</a>	</div>	<div style="margin-top: 5px; float: right; clear: both;">		<img src="assets/profile.png" style="float: right; margin-top: 20px;" />		<ul class="info">			<li><b>Usuário:</b> <a href="?page=acesso/alterar-senha"><?php echo $user['nm_login']; ?>			</a>			</li>			<li><b>Último Acesso:</b> <?php echo ($user['ultimo_acesso'] ? $user['ultimo_acesso'] : ' - '); ?>			</li>			<li><?php 
			$sql = "select ds_modulo from tethys.tb_modulo where ci_modulo = ".Session::get('cd_modulo');
			$rs = Connection::query($sql);
			$row = $rs->fetch();
			?> <b>Módulo:</b> <?php echo @$row['ds_modulo']; ?>			</li>		</ul>	</div>	<br clear="all" />	<div id="logo">		<a class="logo" href="."><img src="assets/logomarca-neide.png" /> </a>	</div>	<div class="data-hora">		<img src="assets/icon_date.gif" align="left" />		<?php echo date('d/m/Y - H:i'); ?>	</div></div><div id="menu"><?php
ob_start();
require('includes/menu.php');
$menuhtml = ob_get_contents();
ob_end_clean();
$menuxml = simplexml_load_string($menuhtml, 'SimpleXMLElement', LIBXML_NOCDATA);

$pages = array();
readMenu($menuxml);
echo $menuhtml;
?></div><div id="caminho"><?php echo @Controller::getLocation($pages); ?></div><div id="dialog_logout" title="<?php echo Config::SYSTEM; ?>">	<p>Tem certeza que deseja sair?</p></div><script type="text/javascript">
$(function(){
	$('#navigation > li').mouseover(function(){
		$(this).find('ul').show();
	}).mouseout(function(){
		$(this).find('ul').hide();
	});	
	$('#dialog_logout').dialog({
		autoOpen: false,
		width: 250,
		modal: true,
		buttons: {
			"Ok": function() { 
				$(this).dialog("close"); 
				window.location = '?logout=1';
			}, 
			"Cancelar": function() { 
				$(this).dialog("close"); 
			} 
		}
	});	
	$('#button_logout').click(function(){
		$('#dialog_logout').dialog('open');
		return false;
	});
});
</script>